#include <stdio.h>

int main(){
    int arr[] = {8,4,1,3,2,7,5,9,6};
    int n = sizeof(arr)/sizeof(arr[0]);
    for(int i=0;i<n-1;i++){
        int max = 0,m = 0;
        for(int j=0;j<n-i;j++){
            if (arr[j]>max){
                max = arr[j];
                m = j;
            }
        }
        int temp = arr[m];
        arr[m] = arr[n-i-1];
        arr[n-i-1] = temp;
    }
    for(int i=0;i<n;i++){printf("%d ",arr[i]);}


    return 0;
}